﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SlaughterItem.API.Application.Commands.Week01.ManageCommands.Clientses;
using SlaughterItem.API.Application.Commands.Week01.SectionCommands;
using SlaughterItem.API.Application.Commands.Week01.UsersCommands;
using SlaughterItem.Common.Dtos;

namespace SlaughterItem.API.Controllers
{
    /// <summary>
    /// 第一周项目控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Week01Controller : ControllerBase
    {
        IMediator mediator;

        public Week01Controller(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> UsersAdd(UsersAddCommand cmd)
        {
            return await mediator.Send(cmd);
        }


        /// <summary>
        /// 客户添加
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetClients(ClientsAddCommend cmd)
        {
            return await mediator.Send(cmd);
        }

        #region 部门管理
        /// <summary>
        /// 部门添加
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> AddSectionData(SectionAddCommend cmd)
        {
            return await mediator.Send(cmd);
        }
        #endregion
    }
}
